/*
package com.ruoyi.project.tool.swagger.UserController;

import com.ruoyi.common.exception.BaseException;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.framework.aspectj.lang.annotation.Ide;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.annotation.SignatureValidation;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.system.domain.SysGood;
import com.ruoyi.project.system.domain.SysImg;
import com.ruoyi.project.system.domain.SysLuck;
import com.ruoyi.project.system.service.ISysGoodService;
import com.ruoyi.project.system.service.ISysLuckService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

*/
/**
 * 中奖订单Controller
 *
 * @author theme
 * @date 2021-01-17
 *//*

@Api(description = "中奖订单Controller")
@RestController
@RequestMapping("/mobileUser/luck")
public class UserLuckController extends BaseController {
    @Autowired
    private ISysLuckService sysLuckService;

    @Autowired
    private ISysGoodService sysGoodService;

    @Autowired
    private UserController userController;

    private Lock lock = new ReentrantLock(true);

    private static int corePoolSize = Runtime.getRuntime().availableProcessors();
    */
/**
     * 创建线程池  调整队列数 拒绝服务
     *//*

    private static ThreadPoolExecutor executor  = new ThreadPoolExecutor(corePoolSize, corePoolSize+1, 10l, TimeUnit.SECONDS,
            new LinkedBlockingQueue<>(1000));

    */
/**
     * 查询中奖订单列表
     *//*

    @ApiOperation("轮播中奖用户信息")
    @GetMapping("/rewardList")
    @SignatureValidation
    @Ide
    public AjaxResult rewardList() {
        SysLuck sysLuck=new SysLuck();
        sysLuck.setReward("1");
        List<SysLuck> list = sysLuckService.selectSysResult(sysLuck);
        if(!list.isEmpty()){
            for(SysLuck luck:list){
                if(StringUtils.isNotEmpty(luck.getPhone())){
                    luck.setPhone(luck.getPhone().replaceAll("(\\d{3})\\d{4}(\\d{4})","$1****$2"));
                }
            }
        }
        return AjaxResult.success(list);
    }


    */
/**
     * 查询中奖订单列表
     *//*

    @ApiOperation("分页查询我的订单")
    @GetMapping("/list")
    @SignatureValidation
    @Ide
    public TableDataInfo list(SysLuck sysLuck, HttpServletRequest servletRequest) throws Exception {
        AjaxResult ajaxResult=userController.getOpenId(servletRequest);
        if(Integer.valueOf(ajaxResult.get("code")+"")!=200){
            throw new BaseException("获取用户信息异常");
        }
        sysLuck.setBankUserSign(ajaxResult.get("data")+"");
        startPage();
        List<SysLuck> list = sysLuckService.selectSysLuckList(sysLuck);
        if(!list.isEmpty()){
            for(SysLuck luck:list){
                SysGood sysGood=sysGoodService.selectSysGoodById(luck.getGoodId());
                luck.setSysGood(sysGood);
            }
        }
        return getDataTable(list);
    }
    */
/**
     * 查询中奖订单列表
     *//*

    @ApiOperation("抽奖")
    @PostMapping("/getLuck")
    @SignatureValidation
    @Ide
    public AjaxResult luck(@RequestBody Map map,HttpServletRequest servletRequest) throws Exception {
        AjaxResult ajaxResult=userController.getOpenId(servletRequest);
        if(Integer.valueOf(ajaxResult.get("code")+"")!=200){
            throw new BaseException("获取用户信息异常");
        }
        map.put("bankUserSign",ajaxResult.get("data"));
        AjaxResult result=AjaxResult.error();
        try {
            lock.lock();
            result= sysLuckService.luck(map);
        }catch (Exception e){
            throw new BaseException("系统错误!");
        }finally {
            lock.unlock();
        }

        return result;
    }
*/
/*
    @GetMapping("/getLuckTest")
    public AjaxResult get(){
        for(int i=0;i<1000;i++){
            Map map=new HashMap();
            map.put("bankUserSign","11111");
            Runnable task = () -> {
                try {
                    lock.lock();
                    sysLuckService.luck(map);
                }catch (Exception e){
                    throw new BaseException("系统错误!");
                }finally {
                    lock.unlock();
                }
            };
            executor.execute(task);
        }
        return null;
    }*//*




    */
/**
     * 获取商品详细信息
     *//*

    @ApiOperation("获取商品详细信息")
    @GetMapping(value = "/good/{goodId}")
    public AjaxResult getInfo(@PathVariable("goodId") Long goodId) {
        SysGood sysGood=sysGoodService.selectSysGoodById(goodId);
        SysLuck luck=new SysLuck();
        luck.setReward("1");
        luck.setGoodId(sysGood.getGoodId());
        List<SysLuck> list=sysLuckService.selectSysLuckList(luck);
        sysGood.setTimes(list.size());
        return AjaxResult.success(sysGood);
    }

}


*/
